<template>
  <el-dialog :append-to-body="true" :visible.sync="dialog" :title="isAdd ? '新增订单' : '编辑订单'" width="800px">
    <el-form ref="form" :model="form" :rules="rules" :inline="true" label-width="80px" size="small" >
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="添加日期" label-width="100px">
        <div class="block">
          <el-date-picker v-model="form.createtime" :picker-options="tjrq" align="right" type="date" placeholder="选择日期"/>
        </div>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="城市" style="vertical-align: center;" label-width="100px">
        <template>
          <div class="block">
            <el-cascader :options="options" v-model="form.shengshixian" multiple placeholder="请选择地址" clearable expand-trigger="hover" class="filter-item" style="width: 220px" @change="handleChange"/>
          </div>
        </template>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="单位名称" label-width="100px">
        <el-input v-model="form.danwei" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="金额" label-width="100px">
        <el-input v-model="form.jine" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="开票日期" label-width="100px">
        <div class="block">
          <el-date-picker v-model="form.kaipiaoriqi" :picker-options="tjrq" align="right" type="date" placeholder="选择日期"/>
        </div>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="回款金额" label-width="100px">
        <el-input v-model="form.huikuanjine" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="回款日期" label-width="100px">
        <div class="block" >
          <el-date-picker v-model="form.huikuanriqi" :picker-options="tjrq" align="right" type="date" placeholder="选择日期"/>
        </div>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="合同编号" label-width="100px">
        <el-input v-model="form.hetongbianhao" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="是否开票" label-width="100px">
        <el-tooltip :content="'您的选择: ' + form.iskaipiao" placement="top">
          <el-switch v-model="form.iskaipiao" active-color="#13ce66" inactive-color="#dcdfe6" active-value="已开票" inactive-value="未开票"/>
        </el-tooltip>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="合同寄回" label-width="100px">
        <el-tooltip :content="'您的选择: ' + form.ishetongjihui" placement="top">
          <el-switch v-model="form.ishetongjihui" active-color="#13ce66" inactive-color="#dcdfe6" active-value="已寄回" inactive-value="未寄回"/>
        </el-tooltip>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','kuguan']" label="机器发出" label-width="100px">
        <el-tooltip :content="'您的选择: ' + form.isjiqifachu" placement="top">
          <el-switch v-model="form.isjiqifachu" active-color="#13ce66" inactive-color="#dcdfe6" active-value="已发出" inactive-value="未发出"/>
        </el-tooltip>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','gongchengshi']" label="是否部署" label-width="100px">
        <el-tooltip :content="'您的选择: ' + form.isbushu" placement="top">
          <el-switch v-model="form.isbushu" active-color="#13ce66" inactive-color="#dcdfe6" active-value="已部署" inactive-value="未部署"/>
        </el-tooltip>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="部署人" label-width="100px" >
        <el-select v-model="form.bushuren" clearable placeholder="部署人" size="mini" class="filter-item" style="width: 220px">
          <el-option v-for="item in dictMap.ygmc" :key="item.value" :label="item.value" :value="item.value"/>
        </el-select>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="联系人" label-width="100px">
        <el-input v-model="form.lianxiren" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="联系电话" label-width="100px">
        <el-input v-model="form.lianxidianhua" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="地址" label-width="100px">
        <el-input v-model="form.dizhi" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="账户类型" label-width="100px">
        <el-select v-model="form.zhanghuleixing" placeholder="账户类型" size="mini" class="filter-item" style="width:220px">
          <el-option v-for="item in dictMap.gslx" :key="item.value" :label="item.value" :value="item.value"/>
        </el-select>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="批次" label-width="100px">
        <el-select v-model="form.pici" placeholder="批次" size="mini" class="filter-item" style="width:220px">
          <el-option v-for="item in dictMap.pici" :key="item.value" :label="item.value" :value="item.value"/>
        </el-select>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','gongchengshi']" label="部署日期" label-width="100px">
        <div class="block">
          <el-date-picker v-model="form.bushuriqi" :picker-options="tjrq" align="right" type="date" placeholder="选择日期"/>
        </div>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','gongchengshi']" label="上门次数" label-width="100px">
        <el-input-number v-model="form.shangmencishu" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="合同负责人" label-width="100px">
        <el-select v-model="form.hetongfuzeren" clearable placeholder="合同负责人" size="mini" class="filter-item" style="width: 220px">
          <el-option v-for="item in dictMap.ygmc" :key="item.value" :label="item.value" :value="item.value"/>
        </el-select>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','kuguan']" label="机器快递号" label-width="100px">
        <el-input v-model="form.jiqikuaidihao" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu','kuguan']" label="合同快递号" label-width="100px">
        <el-input v-model="form.hetongkuaidihao" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="维保到期日" label-width="100px">
        <div class="block">
          <el-date-picker v-model="form.weibaodaoqiri" :picker-options="tjrq" align="right" type="date" placeholder="选择日期"/>
        </div>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="主机数量" label-width="100px">
        <el-input-number v-model="form.zhujishuliang" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="HF510数量" label-width="100px">
        <el-input-number v-model="form.hfwuyaoling" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="HF580数量" label-width="100px">
        <el-input-number v-model="form.hfwubaling" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="ZF510数量" label-width="100px">
        <el-input-number v-model="form.zfwuyaoling" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="ZF517数量" label-width="100px">
        <el-input-number v-model="form.zfwuyaoqi" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="超翔(台式)" label-width="100px">
        <el-input-number v-model="form.chaoxiang" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="超锐(便携)" label-width="100px">
        <el-input-number v-model="form.chaorui" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="昭阳(便携)" label-width="100px">
        <el-input-number v-model="form.zhaoyang" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="中孚三合一" label-width="100px">
        <el-input-number v-model="form.zhongfusanheyi" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="万里红三合一" label-width="100px">
        <el-input-number v-model="form.wanlihongsanheyi" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="数科" label-width="100px">
        <el-input-number v-model="form.shuke" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="金山" label-width="100px">
        <el-input-number v-model="form.jinshan" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="永中" label-width="100px">
        <el-input-number v-model="form.yongzhong" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="安天" label-width="100px">
        <el-input-number v-model="form.antian" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="360杀毒" label-width="100px">
        <el-input-number v-model="form.sanliuling" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="中孚主审" label-width="100px">
        <el-input-number v-model="form.zhongfuzhushen" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="万里红主审" label-width="100px">
        <el-input-number v-model="form.wanlihongzhushen" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="汉邦主审" label-width="100px">
        <el-input-number v-model="form.hanbangzhushen" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="北信源身份鉴别" label-width="100px">
        <el-input-number v-model="form.beixinyuanshenfenjianbie" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="中孚身份鉴别" label-width="100px">
        <el-input-number v-model="form.zhongfushenfenjianbie" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="汉邦刻录审计" label-width="100px">
        <el-input-number v-model="form.hanbangdayinkelushenji" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="A260PN" label-width="100px">
        <el-input-number v-model="form.aerliulingpn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="C260PN" label-width="100px">
        <el-input-number v-model="form.cerliulingpn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="CM7000FDN" label-width="100px">
        <el-input-number v-model="form.cmqilinglinglingfdn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="M7105DN" label-width="100px">
        <el-input-number v-model="form.mqiyaolingwudn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="CP2500DN" label-width="100px">
        <el-input-number v-model="form.cperwulinglingdn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="CP2505DN" label-width="100px">
        <el-input-number v-model="form.cperwulingwudn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="P2505" label-width="100px">
        <el-input-number v-model="form.perwulingwu" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="P3305DN" label-width="100px">
        <el-input-number v-model="form.psansanlingwudn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="CM8505DN" label-width="100px">
        <el-input-number v-model="form.cmbawulingwudn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="M9005DN" label-width="100px">
        <el-input-number v-model="form.mjiulinglingwudn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="P5000DN" label-width="100px">
        <el-input-number v-model="form.pwulinglinglingdn" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="DS-230" label-width="100px">
        <el-input-number v-model="form.dsersanling" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="F301H" label-width="100px">
        <el-input-number v-model="form.fsanlingyaoh" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item v-permission="['ADMIN','BUSHUTONGJI_ALL','BUSHUTONGJI_EDIT','caiwu']" label="红黑电源" label-width="100px">
        <el-input-number v-model="form.hongheidianyuanchazuo" :min="0" :max="10000000" label="描述文字" style="width: 220px;"/>
      </el-form-item>
      <el-form-item label="备注" label-width="100px">
        <el-input v-model="form.beizhu" type="textarea" style="width: 550px;"/>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="cancel">取消</el-button>
      <el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { add, edit } from '@/api/bushutongji'
import initDict from '@/mixins/initDict'
export default {
  mixins: [initDict],
  props: {
    isAdd: {
      type: Boolean,
      required: true
    }
  },
  data() {
    return {
      gslx: [], // 字典
      ygmc: [], // 字典
      loading: false, dialog: false,
      form: {
        id: '',
        createtime: '',
        shengshixian: '',
        sheng: '',
        city: '',
        xian: '',
        danwei: '',
        jine: '',
        iskaipiao: '',
        kaipiaoriqi: '',
        huikuanjine: '',
        huikuanriqi: '',
        ishetongjihui: '',
        isjiqifachu: '',
        isbushu: '',
        bushuren: '',
        hetongbianhao: '',
        lianxiren: '',
        lianxidianhua: '',
        dizhi: '',
        zhanghuleixing: '',
        pici: '',
        bushuriqi: '',
        shangmencishu: '',
        hetongfuzeren: '',
        jiqikuaidihao: '',
        hetongkuaidihao: '',
        weibaodaoqiri: '',
        zhujishuliang: '',
        hfwuyaoling: '',
        hfwubaling: '',
        zfwuyaoling: '',
        zfwuyaoqi: '',
        chaoxiang: '',
        chaorui: '',
        zhaoyang: '',
        zhongfusanheyi: '',
        wanlihongsanheyi: '',
        shuke: '',
        jinshan: '',
        yongzhong: '',
        antian: '',
        sanliuling: '',
        zhongfuzhushen: '',
        wanlihongzhushen: '',
        hanbangzhushen: '',
        beixinyuanshenfenjianbie: '',
        zhongfushenfenjianbie: '',
        hanbangdayinkelushenji: '',
        aerliulingpn: '',
        cerliulingpn: '',
        cmqilinglinglingfdn: '',
        mqiyaolingwudn: '',
        cperwulinglingdn: '',
        cperwulingwudn: '',
        perwulingwu: '',
        psansanlingwudn: '',
        cmbawulingwudn: '',
        mjiulinglingwudn: '',
        pwulinglinglingdn: '',
        dsersanling: '',
        fsanlingyaoh: '',
        hongheidianyuanchazuo: '',
        beizhu: ''
      }, options: [{
        value: '广西',
        label: '广西',
        children: [{
          value: '南宁市',
          label: '南宁市',
          children: [{
            value: '兴宁区',
            label: '兴宁区'
          }, {
            value: '青秀区',
            label: '青秀区'
          }, {
            value: '江南区',
            label: '江南区'
          }, {
            value: '西乡塘区',
            label: '西乡塘区'
          }, {
            value: '良庆区',
            label: '良庆区'
          }, {
            value: '邕宁区',
            label: '邕宁区'
          }, {
            value: '武鸣区',
            label: '武鸣区'
          }, {
            value: '隆安县',
            label: '隆安县'
          }, {
            value: '马山县',
            label: '马山县'
          }, {
            value: '上林县',
            label: '上林县'
          }, {
            value: '宾阳县',
            label: '宾阳县'
          }, {
            value: '横县',
            label: '横县'
          }]
        }, {
          value: '柳州市',
          label: '柳州市',
          children: [{
            value: '城中区',
            label: '城中区'
          }, {
            value: '鱼峰区',
            label: '鱼峰区'
          }, {
            value: '柳南区',
            label: '柳南区'
          }, {
            value: '柳北区',
            label: '柳北区'
          }, {
            value: '柳江区',
            label: '柳江区'
          }, {
            value: '柳城县',
            label: '柳城县'
          }, {
            value: '鹿寨县',
            label: '鹿寨县'
          }, {
            value: '融安县',
            label: '融安县'
          }, {
            value: '融水苗族自治县',
            label: '融水苗族自治县'
          }, {
            value: '三江侗族自治县',
            label: '三江侗族自治县'
          }]
        }, {
          value: '桂林市',
          label: '桂林市',
          children: [{
            value: '秀峰区',
            label: '秀峰区'
          }, {
            value: '叠彩区',
            label: '叠彩区'
          }, {
            value: '象山区',
            label: '象山区'
          }, {
            value: '七星区',
            label: '七星区'
          }, {
            value: '雁山区',
            label: '雁山区'
          }, {
            value: '临桂区',
            label: '临桂区'
          }, {
            value: '阳朔县',
            label: '阳朔县'
          }, {
            value: '临川县',
            label: '临川县'
          }, {
            value: '全州县',
            label: '全州县'
          }, {
            value: '兴安县',
            label: '兴安县'
          }, {
            value: '永福县',
            label: '永福县'
          }, {
            value: '灌阳县',
            label: '灌阳县'
          }, {
            value: '龙胜各族自治县',
            label: '龙胜各族自治县'
          }, {
            value: '资源县',
            label: '资源县'
          }, {
            value: '平乐县',
            label: '平乐县'
          }, {
            value: '荔浦县',
            label: '荔浦县'
          }, {
            value: '恭城瑶族自治县',
            label: '恭城瑶族自治县'
          }]
        }, {
          value: '梧州市',
          label: '梧州市',
          children: [{
            value: '万秀区',
            label: '万秀区'
          }, {
            value: '长洲区',
            label: '长洲区'
          }, {
            value: '龙圩区',
            label: '龙圩区'
          }, {
            value: '苍梧县',
            label: '苍梧县'
          }, {
            value: '藤县',
            label: '藤县'
          }, {
            value: '蒙山县',
            label: '蒙山县'
          }, {
            value: '岑溪市',
            label: '岑溪市'
          }]
        }, {
          value: '北海市',
          label: '北海市',
          children: [{
            value: '海城区',
            label: '海城区'
          }, {
            value: '银海区',
            label: '银海区'
          }, {
            value: '铁山港区',
            label: '铁山港区'
          }, {
            value: '合浦县',
            label: '合浦县'
          }]
        }, {
          value: '防城港市',
          label: '防城港市',
          children: [{
            value: '港口区',
            label: '港口区'
          }, {
            value: '防城区',
            label: '防城区'
          }, {
            value: '上思县',
            label: '上思县'
          }, {
            value: '东兴市',
            label: '东兴市'
          }]
        }, {
          value: '钦州市',
          label: '钦州市',
          children: [{
            value: '钦南区',
            label: '钦南区'
          }, {
            value: '钦北区',
            label: '钦北区'
          }, {
            value: '灵山县',
            label: '灵山县'
          }, {
            value: '浦北县',
            label: '浦北县'
          }]
        }, {
          value: '贵港市',
          label: '贵港市',
          children: [{
            value: '港北区',
            label: '港北区'
          }, {
            value: '港南区',
            label: '港南区'
          }, {
            value: '平南县',
            label: '平南县'
          }, {
            value: '桂平市',
            label: '桂平市'
          }]
        }, {
          value: '玉林市',
          label: '玉林市',
          children: [{
            value: '玉州区',
            label: '玉州区'
          }, {
            value: '福绵区',
            label: '福绵区'
          }, {
            value: '容县',
            label: '容县'
          }, {
            value: '陆川县',
            label: '陆川县'
          }, {
            value: '博白县',
            label: '博白县'
          }, {
            value: '兴业县',
            label: '兴业县'
          }, {
            value: '北流市',
            label: '北流市'
          }]
        }, {
          value: '百色市',
          label: '百色市',
          children: [{
            value: '右江区',
            label: '右江区'
          }, {
            value: '田阳县',
            label: '田阳县'
          }, {
            value: '田东县',
            label: '田东县'
          }, {
            value: '平果县',
            label: '平果县'
          }, {
            value: '德保县',
            label: '德保县'
          }, {
            value: '那坡县',
            label: '那坡县'
          }, {
            value: '凌云县',
            label: '凌云县'
          }, {
            value: '乐业县',
            label: '乐业县'
          }, {
            value: '田林县',
            label: '田林县'
          }, {
            value: '西林县',
            label: '西林县'
          }, {
            value: '隆林各族自治县',
            label: '隆林各族自治县'
          }, {
            value: '靖西市',
            label: '靖西市'
          }]
        }, {
          value: '贺州市',
          label: '贺州市',
          children: [{
            value: '八步区',
            label: '八步区'
          }, {
            value: '平桂区',
            label: '平桂区'
          }, {
            value: '昭平县',
            label: '昭平县'
          }, {
            value: '钟山县',
            label: '钟山县'
          }]
        }, {
          value: '河池市',
          label: '河池市',
          children: [{
            value: '金城江区',
            label: '金城江区'
          }, {
            value: '南丹县',
            label: '南丹县'
          }, {
            value: '天峨县',
            label: '天峨县'
          }, {
            value: '凤山县',
            label: '凤山县'
          }, {
            value: '罗城仫佬族自治县',
            label: '罗城仫佬族自治县'
          }, {
            value: '环江毛南族自治县',
            label: '环江毛南族自治县'
          }, {
            value: '巴马瑶族自治县',
            label: '巴马瑶族自治县'
          }, {
            value: '都安瑶族自治县',
            label: '都安瑶族自治县'
          }, {
            value: '大化瑶族自治县',
            label: '大化瑶族自治县'
          }, {
            value: '宜州市',
            label: '宜州市'
          }]
        }, {
          value: '来宾市',
          label: '来宾市',
          children: [{
            value: '兴宾区',
            label: '兴宾区'
          }, {
            value: '忻城县',
            label: '忻城县'
          }, {
            value: '象州县',
            label: '象州县'
          }, {
            value: '武宣县',
            label: '武宣县'
          }, {
            value: '金秀瑶族自治县',
            label: '金秀瑶族自治县'
          }, {
            value: '合山市',
            label: '合山市'
          }]
        }, {
          value: '崇左市',
          label: '崇左市',
          children: [{
            value: '江州区',
            label: '江州区'
          }, {
            value: '扶绥县',
            label: '扶绥县'
          }, {
            value: '宁明县',
            label: '宁明县'
          }, {
            value: '龙州县',
            label: '龙州县'
          }, {
            value: '大新县',
            label: '大新县'
          }, {
            value: '天等县',
            label: '天等县'
          }, {
            value: '凭祥市',
            label: '凭祥市'
          }]
        }]
      }, {
        value: '其他省',
        label: '其他省',
        children: [{
          value: '其他城市',
          label: '其他城市',
          children: [{
            value: '其他县',
            label: '其他县'
          }]
        }]
      }],
      rules: {
      },
      tjrq: {
        disabledDate(time) {
          return time.getTime() > Date.now()
        },
        shortcuts: [{
          text: '今天',
          onClick(picker) {
            picker.$emit('pick', new Date())
          }
        }, {
          text: '昨天',
          onClick(picker) {
            const date = new Date()
            date.setTime(date.getTime() - 3600 * 1000 * 24)
            picker.$emit('pick', date)
          }
        }, {
          text: '一周前',
          onClick(picker) {
            const date = new Date()
            date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
            picker.$emit('pick', date)
          }
        }]
      }
    }
  },
  created() {
    this.$nextTick(() => {
      this.getDictMap('gslx,ygmc,pici')
    })
  },
  methods: {
    cancel() {
      this.resetForm()
    },
    doSubmit() {
      this.loading = true
      if (this.isAdd) {
        this.doAdd()
      } else this.doEdit()
    },
    doAdd() {
      this.form.sheng = this.form.shengshixian[0]
      this.form.city = this.form.shengshixian[1]
      this.form.xian = this.form.shengshixian[2]
      add(this.form).then(res => {
        this.resetForm()
        this.$notify({
          title: '添加成功',
          type: 'success',
          duration: 2500
        })
        this.loading = false
        this.$parent.init()
      }).catch(err => {
        this.loading = false
        console.log(err.response.data.message)
      })
    },
    doEdit() {
      this.form.sheng = this.form.shengshixian[0]
      this.form.city = this.form.shengshixian[1]
      this.form.xian = this.form.shengshixian[2]
      edit(this.form).then(res => {
        this.resetForm()
        this.$notify({
          title: '修改成功',
          type: 'success',
          duration: 2500
        })
        this.loading = false
        this.$parent.init()
      }).catch(err => {
        this.loading = false
        console.log(err.response.data.message)
      })
    },
    cityChange(data) {
      console.log(data)
    },
    resetForm() {
      this.dialog = false
      this.$refs['form'].resetFields()
      this.form = {
        id: '',
        createtime: '',
        city: '',
        danwei: '',
        jine: '',
        iskaipiao: '',
        kaipiaoriqi: '',
        huikuanjine: '',
        huikuanriqi: '',
        ishetongjihui: '',
        isjiqifachu: '',
        isbushu: '',
        bushuren: '',
        hetongbianhao: '',
        lianxiren: '',
        lianxidianhua: '',
        dizhi: '',
        zhanghuleixing: '',
        bushuriqi: '',
        shangmencishu: '',
        hetongfuzeren: '',
        jiqikuaidihao: '',
        hetongkuaidihao: '',
        weibaodaoqiri: '',
        shengshixian: []
      }
    },
    handleChange(value) {
      console.log(value)
    }
  }
}
</script>

<style scoped>

</style>
